/**
 * 
 */
package com.buddyface;


import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * @author arnaud
 *
 */
public class BFBroadcastReceiver extends BroadcastReceiver {

	private int APP_NOTIFICATION_ID = 1;
	private static final String TAG = "arnaud";


	@Override
	public void onReceive(Context context, Intent intent) {
		Log.d(TAG, "Intent received: " + intent.getAction());
		// Create an intent to wake up the service
		//Intent myIntent = new Intent(context,BFService.class);
		//context.startService(myIntent);
		
	    // Get the notification manager service.
	    String ns = Context.NOTIFICATION_SERVICE;
	    NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
	    
	    int icon = R.drawable.icon;
	    CharSequence tickerText = "Hello";
	    long when = System.currentTimeMillis();

	    Notification notification = new Notification(icon, tickerText, when);
	    
	    CharSequence contentTitle = "New SMS";
	    CharSequence contentText = "Hello World!";
	    Intent notificationIntent = new Intent(context, BFSettings.class);
	    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

	    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

	    mNotificationManager.notify(APP_NOTIFICATION_ID, notification);
		
		//context.startService(service);
		Log.d(TAG,"Incoming call!");

	}

}
